<template>
	<!-- 购物带功能 -->
	<view class="">

		<view class="pdbJr bgcf cart-box">
			<view class="tipsBox df aic p20">
				<nmr-icon name="a-tishi-32" size="30" color="#48A147"></nmr-icon>
				<text class="ml20">
					因冷冻食品特殊性、活物产品等，商品下单后不支持无理由退货，部分商品支持售后服务，介意者谨慎下单。
				</text>
			</view>
			<view class="content " v-if="orderInfo.auditStatus == 1&&orderInfo.optType==2" >
				<view class="selected-goods df aic">
					<view class="df aic" style="margin-left: auto;">
						<u-button class="ml16" :hair-line="false"
							:loading="loading"
							:custom-style="{fontSize: '30rpx', color: '#ffffff',width: '300rpx', height: '88rpx',background: '#EF2929',border: '#EF2929'}"
							shape='circle' ripple @click="handlesubmit">立即支付</u-button>
					</view>



				</view>
			</view>
		</view>
		<u-modal v-model="showCart" :title-style="{color: 'red'}" content="确认执行该操作吗？" @confirm="subConfirm"
			show-cancel-button ref="uModal" :async-close="true"></u-modal>
		<view class="mdbJr" style="height: 215rpx;"></view>
	</view>

</template>

<script>
	import {
		shopPurOrderAudit,
		shopPurOrderDel
	} from '@/api/order.js'
	export default {
		props: {
			loading: {
				type: Boolean,
				default: false
			},
			orderId: {
				default: ''
			},
			orderInfo: {
				default: {}
			},
			drawSetByOrderInfo: {
				default: {},
				type: Object
			},
		},
		data() {
			return {
				showCart: false,
				type: ''
			}
		},
		methods: {

			handlesubmit() {
				this.$emit('handlesubmit')
			},
			handleSubmitDf(type) {
				this.type = type
				this.showCart = true
			},

			subConfirm() {
				if (this.type == 'del') {
					shopPurOrderDel(this.orderInfo.shopPurOrderId).then(res => {
						if (res.code == 200) {
							this.$u.toast('操作成功')
							uni.redirectTo({
								url:'/pages/order/order'
							})
							this.showCart = false
						} else {
							this.$refs.uModal.clearLoading();
							this.$u.toast(res.msg)
						}
					})
				} else {
					shopPurOrderAudit({
						shopPurOrderId: this.orderInfo.shopPurOrderId,
						auditStatus: this.type
					}).then(res => {
						if (res.code == 200) {
							this.$u.toast('操作成功')
							this.$emit('purOrderAudit')
							this.showCart = false
						} else {
							this.$refs.uModal.clearLoading();
							this.$u.toast(res.msg)
						}
					})
				}

			},
		}
	}
</script>

<style lang="scss" scoped>
	.tipsBox {
		width: 750rpx;
		// height: 93rpx;
		background: #F0FFF0;
		color: #48A147;
		box-sizing: border-box;
		padding: 5rpx 10rpx;
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFangSC-Regular;
	}

	$theme-text: #47A848;

	.cart-box {
		width: 100%;
		position: fixed;
		z-index: 1203;
		bottom: 0;

		.price {
			font-size: 40rpx;
			font-family: PingFangSC-Semibold-, PingFangSC-Semibold;
			font-weight: normal;
			color: #EF2929;

		}

		.desc {
			font-size: 24rpx;
			font-family: PingFangSC-Regular-, PingFangSC-Regular;
			font-weight: normal;
			color: #47A848;
			margin-left: 75rpx;
		}

		.content {
			margin: 17rpx 30rpx;
		}

	}
</style>